<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>add User</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<!--导入核心文件-->
		<script src="../../bootstrap3/js/holder.js" type=""></script>
		<link href="../../bootstrap3/css/bootstrap.css" rel="stylesheet" type="text/css">
		<script src="../../bootstrap3/jquery-1.9.1.min.js" type=""></script>
		<script src="../../bootstrap3/js/bootstrap.js" type=""></script>
		<!-- 字体图标 -->
		<link rel="stylesheet" href="../../bootstrap3/font-awesome-4.7.0/css/font-awesome.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/style.css"/>
	</head>

	<body>
		<div id="wrap">
			<div id="top_content">
					<div id="header">
						<div id="rightheader">
							<p>2009/11/20<br /></p>
						</div>
						<div id="topheader">
							<h1 id="title"><a href="#">添加管理员</a></h1>
						</div>
						<div id="navigation"></div>
					</div>
				<div id="content">
					<p id="whereami"></p>
					<!--<h1>add Role info:</h1>-->
					<form id="form-add-new">
						<table cellpadding="0" cellspacing="0" border="0" class="form_table">
							<tr>
								<td valign="middle" align="right">用户名:</td>
								<td valign="middle" align="left">
									<input type="text" class="inputgri" name="adminName" id="inp-adminName" />
								</td>
							</tr>
							<tr>
								<td valign="middle" align="right">密码：</td>
								<td valign="middle" align="left">
									<input type="text" class="inputgri" name="password" id="inp-password" />
								</td>
							</tr>
						</table>
						<p>
							<input type="button" class="cart-del-sel btn btn-default btn-xs" id="btn-add-new" value="添加"/>
							<input type="reset" class="cart-del-sel btn btn-default btn-xs" value="重置"/>
							<input type="button" class="cart-del-sel btn btn-default btn-xs" value="返回" onclick="location='adminList.html'"/>
						</p>
					</form>
				</div>
			</div>
			<div id="footer">
				<div id="footer_bg">ABC@126.com</div>
			</div>
		</div>
		<script type="text/javascript">
			$("#btn-add-new").click(function () {
				$.ajax({
					"url":"/admin/reg",
					"data":$("#form-add-new").serialize(),
					"type":"post",
					"dataType":"json",
					"success":function (json) {
						if(json.state===2000){
							alert("添加用户成功！");
							//还原表单控件为默认状态
							$("#form-add-new")[0].reset();
						}else{
							alert("添加用户失败！"+json.message);
						}
					},
					"error":function () {
						alert("您的登录信息已过期！请重新登录");
						//location.href="login.html";
					}
				});
			});
		</script>
	</body>
</html>
